package net.batkin.poppler.page;

import net.batkin.poppler.document.Document;

import com.trolltech.qt.gui.QImage;

public class Page {

	@SuppressWarnings( "unused" )
	private long _pageHandle;

	@SuppressWarnings( "unused" )
	private Document doc;

	private Page( Document doc, long pageHandle ) {
		this.doc = doc;
		this._pageHandle = pageHandle;
	}

	public QImage renderToImage() {
		return renderToImage( 72.0, 72.0, -1, -1, -1, -1, Rotation.Rotate0 );
	}

	public QImage renderToImage( double xres, double yres ) {
		return renderToImage( xres, yres, -1, -1, -1, -1, Rotation.Rotate0 );
	}

	public QImage renderToImage( double xres, double yres, int x, int y ) {
		return renderToImage( xres, yres, x, y, -1, -1, Rotation.Rotate0 );
	}

	public QImage renderToImage( double xres, double yres, int x, int y, int w, int h ) {
		return renderToImage( xres, yres, x, y, w, h, Rotation.Rotate0 );
	}

	public native QImage renderToImage( double xres, double yres, int x, int y, int w, int h, Rotation rotate );

	public native String label();

	private native void cleanupPage();

	@Override
	protected void finalize() throws Throwable {
		cleanupPage();
	}
}
